<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  正在测试ajax的基本使用
</body>
<script>

// http://127.0.0.1:5500/day26/data/hello.txt

  const url = "http://127.0.0.1:5500/day26/data/hello.txt";

  const ajax = new XMLHttpRequest();

  ajax.open("get", url);
  
  ajax.send();

  ajax.onreadystatechange = function(){
    // XMLHttpRequest工具的状态
    if( ajax.readyState===4 && ajax.status === 200){
      console.log( ajax.responseText );
    }
  }

  
</script>
</html>